package com.umeng.kaoti5.fragment;

import android.util.Log;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.mvplibrary.mvplibrary.ui.fragment.BaseMvpFragment;
import com.umeng.kaoti5.R;
import com.umeng.kaoti5.adapter.FirstAdapter;
import com.umeng.kaoti5.adapter.ThreeAdapter;
import com.umeng.kaoti5.data.HighOpinion;
import com.umeng.kaoti5.model.MainModel;
import com.umeng.kaoti5.presenter.MainPresenter;
import com.umeng.kaoti5.view.MainView;
import com.youth.banner.Banner;

import java.util.List;

import butterknife.BindView;


public class FirstFragment extends BaseMvpFragment<MainView, MainModel, MainPresenter> implements MainView {


    @BindView(R.id.bannerid)
    Banner bannerid;
    @BindView(R.id.rv_list)
    RecyclerView rvList;
    @BindView(R.id.rv_list1)
    RecyclerView rvList1;

    @Override
    protected MainPresenter createPresenter() {
        return new MainPresenter();
    }

    @Override
    protected void initEvent() {
        presenter.getData();
    }

    @Override
    protected int createLayoutId() {
        return R.layout.fragment_first;
    }

    @Override
    public void showList(List<HighOpinion.ListBean> listBeans) {
        Log.d("TAG", "showList: " + listBeans);
        rvList.setLayoutManager(new LinearLayoutManager(context));
        ThreeAdapter threeAdapter = new ThreeAdapter(listBeans, context, R.layout.layout_items);
        rvList.setAdapter(threeAdapter);
        rvList1.setLayoutManager(new LinearLayoutManager(context));
        FirstAdapter firstAdapter = new FirstAdapter(listBeans, context, R.layout.layout_item);
        rvList1.setAdapter(firstAdapter);
    }

    @Override
    public void showError(String error) {

    }

    @Override
    public void showProgressbar() {

    }

    @Override
    public void hideProgressbar() {

    }
}